<%@ page language="java" contentType="text/html; charset=UTF-8"
         pageEncoding="UTF-8" %>
<%@ include file="/WEB-INF/view/common/includes.jsp" %>
<%@ include file="/WEB-INF/view/inc.jsp" %>
<html>
<head lang="en">
    <meta charset="UTF-8">
    <title></title>
</head>
<style>
    .panel-body {
        border-bottom-width: 0px;
        border-left-width: 0px;
    }

    .layout-expand .panel-header {
        border-width: 0px;
    }

</style>
<script type="text/javascript">
    $(function(){
        $('#dg').edatagrid({
            url: '<%=contextPath%>/demo/list',
            saveUrl: '<%=contextPath%>/demo/saveAndUpdate',
            updateUrl: '<%=contextPath%>/demo/saveAndUpdate',
            destroyUrl: '<%=contextPath%>/demo/delete'
        });
    });
</script>

<body class="easyui-layout" data-options="fit:true,border:false">
<!-- 搜索框 -->
<div data-options="region:'north',title:'查询条件',border:false" class="north_form_1">
    <form id="searchForm">
        <div class="fitem fl">
            <label>姓名:</label>
            <input name="name" class="easyui-textbox input_class">
        </div>
        <div class="fitem searchItem fr">
            <a class="easyui-linkbutton" iconCls="icon-search" onclick="sy_searchFun()">搜索</a>
            <a class="easyui-linkbutton" iconCls="icon-reload" onclick="sy_resetFun()">重置</a>
        </div>
    </form>
</div>
<div data-options="region:'center',border:false">
    <table id="dg" fit="true"
           data-options="method: 'post',pagination: true,rownumbers:true,idField: 'id', fitColumns:true,singleSelect:true,striped:true,sortName:'createTime',sortOrder:'desc',toolbar: '#toolbar'">
        <thead>
        <tr>
            <th data-options="field:'id'" width="100" hidden="true" sortable="true" >id</th>
            <th data-options="field:'name'" width="100" sortable="true"  editor="{type:'validatebox',options:{required:true}}">姓名</th>
            <th data-options="field:'age'" width="100" sortable="true" editor="{type:'numberspinner',options:{required:true}}">年龄</th>
            <th data-options="field:'remark'" width="100" sortable="true" editor="{type:'validatebox'}">备注</th>
            <th data-options="field:'createTime'" width="100" sortable="true" editor="{type:'datetimebox'}">创建时间</th>
            <th data-options="field:'createBy',dictionary:'userStatus',formatter:sy_dict" width="100" sortable="true"  editor="{type:'combobox',options:{valueField:'code',textField:'name',url:'<%=contextPath%>/sys/codeItems/byCategoryCode?categoryCode=userStatus'}}">状态</th>
        </tr>
        </thead>
    </table>
</div>
<div id="toolbar">
    <t:button  action="demo_add" iconCls="icon-add" plain="true" onclick="javascript:$('#dg').edatagrid('addRow',0)" buttonName="新增" />
    <t:button action="demo_remove"  iconCls="icon-remove" plain="true" onclick="javascript:$('#dg').edatagrid('destroyRow')" buttonName="删除" />
    <t:button action="demo_save" iconCls="icon-save" plain="true" onclick="javascript:$('#dg').edatagrid('saveRow')" buttonName="保存" />
    <t:button action="demo_cancel" iconCls="icon-undo" plain="true" onclick="javascript:$('#dg').edatagrid('cancelRow')" buttonName="取消"/>
</div>
</body>
</html>